<?php
class Jskull_model extends CI_Model {

    var $id   = '';
    var $name = '';
    var $link = '';
    var $img  = '';

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
    
    function get_skulls($from, $limit)
    {
        $query = $this->db->get('jskull',$from,$limit);
        return $query->result();
    }
    
    function get_all_skulls()
    { 
        $sql = "SELECT * 
                FROM jskull
                ORDER BY DATE_JOIN ASC";
        $query = $this->db->query($sql);
        $skull['quant'] = 0;
        foreach ($query->result() as $row){            
            $skull[$skull['quant']]['TYPE'] = $row->TYPE;
            $skull[$skull['quant']]['NAME'] = $row->NAME;
            $skull[$skull['quant']]['LINK'] = $row->LINK;
            $skull[$skull['quant']]['IMG'] = $row->IMG;
            $skull[$skull['quant']]['DESCRIPTION'] = $row->DESCRIPTION;
            $skull[$skull['quant']]['DATE_JOIN'] = $row->DATE_JOIN;
            $skull[$skull['quant']]['TEACHER_CHARGE_NAME']=$row->TEACHER_CHARGE_NAME;
            $skull[$skull['quant']]['TEACHER_CHARGE_EMAIL']=$row->TEACHER_CHARGE_EMAIL;
            $skull['quant']++;
        }
        return $skull;
    }
    
    function get_all_skulls_alt()
    { 
        $sql = "SELECT * 
                FROM jskull";
        $query = $this->db->query($sql);
        $skull['quant'] = 0;
        foreach ($query->result() as $row){            
            $skull[$skull['quant']]['TYPE'] = $row->TYPE;
            $skull[$skull['quant']]['NAME'] = $row->NAME;
            $skull[$skull['quant']]['LINK'] = $row->LINK;
            $skull[$skull['quant']]['IMG'] = $row->IMG;
            $skull[$skull['quant']]['DESCRIPTION'] = $row->DESCRIPTION;
            $skull[$skull['quant']]['DATE_JOIN'] = $row->DATE_JOIN;
            $skull[$skull['quant']]['TEACHER_CHARGE_NAME']=$row->TEACHER_CHARGE_NAME;
            $skull[$skull['quant']]['TEACHER_CHARGE_EMAIL']=$row->TEACHER_CHARGE_EMAIL;
            $skull['quant']++;
        }
        return $skull;
    }
}
?>